<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: DHTMLConfirm</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">DHTMLConfirm</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/vendor/plugins/active_scaffold/lib/dhtml_confirm_rb.html">
                vendor/plugins/active_scaffold/lib/dhtml_confirm.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Matt Mower &lt;matt@cominded.com&gt;
</p>
<p>
A base class for creating DHTML confirmation types.
</p>
<p>
The real work is done by the <a
href="DHTMLConfirm.html#M000018">onclick_function</a> and <a
href="DHTMLConfirm.html#M000019">onclick_handler</a> methods. In general it
should only be required to override the default <a
href="DHTMLConfirm.html#M000019">onclick_handler</a> method and provide the
specific Javascript required to invoke the DHTML confirm dialog of your
choice.
</p>
<p>
It is up to this dialog, if the user confirms the intended action, to
invoke the function window.gFireModalLink() to trigger the intended action
of the link. For example, using the Modalbox library, you would use
something like:
</p>
<pre>
    Modalbox.hide( {
              afterHide: function() {
                window.gFireModalLink();
              } } );
</pre>
<p>
By default the only action recognized is :value which is used to add a
dhtml_confirm attribute to the link &lt;a&gt; tag. This value is detected
by the <a href="ActiveScaffold.html">ActiveScaffold</a> link and triggers
the DHTML confirmation logic.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000020">ensure_termination</a>&nbsp;&nbsp;
      <a href="#M000017">new</a>&nbsp;&nbsp;
      <a href="#M000018">onclick_function</a>&nbsp;&nbsp;
      <a href="#M000019">onclick_handler</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">message</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">options</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">value</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000017" class="method-detail">
        <a name="M000017"></a>

        <div class="method-heading">
          <a href="#M000017" class="method-signature">
          <span class="method-name">new</span><span class="method-args">( options = {} )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000017-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/dhtml_confirm.rb, line 26</span>
26:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>( <span class="ruby-identifier">options</span> = {} )
27:     <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
28:     <span class="ruby-ivar">@value</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:value</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-value str">&quot;yes&quot;</span> }
29:     <span class="ruby-ivar">@message</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:message</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-value str">&quot;Are you sure?&quot;</span> }
30:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000018" class="method-detail">
        <a name="M000018"></a>

        <div class="method-heading">
          <a href="#M000018" class="method-signature">
          <span class="method-name">onclick_function</span><span class="method-args">( controller, link_id )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000018-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/dhtml_confirm.rb, line 32</span>
32:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">onclick_function</span>( <span class="ruby-identifier">controller</span>, <span class="ruby-identifier">link_id</span> )
33:     <span class="ruby-identifier">script</span> = <span class="ruby-value str">&quot;window.gFireModalLink = function() {\nvar link = $('\#{link_id}').action_link;\nlink.open_action.call( link );\n};\n\#{ensure_termination(onclick_handler(controller,link_id))}\nreturn false;\n&quot;</span>
34:     <span class="ruby-comment cmt"># script = &quot;window.gModalLink = $('#{link_id}').action_link;#{onclick_handler(controller,link_id)}return false;&quot;</span>
35:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">onclick_handler</span><span class="method-args">( controller, link_id )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/dhtml_confirm.rb, line 45</span>
45:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">onclick_handler</span>( <span class="ruby-identifier">controller</span>, <span class="ruby-identifier">link_id</span> )
46:     <span class="ruby-value str">&quot;&quot;</span>
47:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <a href="#M000020" class="method-signature">
          <span class="method-name">ensure_termination</span><span class="method-args">( expression )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000020-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/dhtml_confirm.rb, line 50</span>
50:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ensure_termination</span>( <span class="ruby-identifier">expression</span> )
51:     <span class="ruby-identifier">expression</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/;$/</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">expression</span> <span class="ruby-operator">:</span> <span class="ruby-node">&quot;#{expression};&quot;</span>
52:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>